package com.adjaisd.scarecrow.testJava;

import com.adjaisd.scarecrow.entity.Device;
import com.adjaisd.scarecrow.entity.Quota;
import com.adjaisd.scarecrow.service.DeviceService;
import com.adjaisd.scarecrow.service.PanelService;
import com.adjaisd.scarecrow.vo.Pager;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class testPanel {

    @Autowired
    DeviceService deviceService;

    @Autowired
    PanelService panelService;

    @Test
    void testGetDevicePage() {
        long userId = 1L;
        long page = 1L;
        long pageSize = 10L;
        String number = "";
        // String number = 10003;
        Pager<Device> devicePage = panelService.getDevicePage(userId, page, pageSize, number);
        for (Device device : devicePage.getItems()) {
            System.out.println(device);
        }
    }

    @Test
    void testGetQuotaPage() {
        long userId = 1L;
        long page = 1L;
        long pageSize = 10L;
        Long number = 10003L;
        Device device = deviceService.getDeviceByNumberUID(number, userId);
        Pager<Quota> quotaList = panelService.getQuotaPage(userId, page, pageSize, device.getId() + "");
        for (Quota item : quotaList.getItems()) {
            System.out.println(item);
        }
    }

}
